package com.test.activiti;

import org.activiti.engine.IdentityService;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.identity.Group;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)//这里的Application是springboot的启动类名
@WebAppConfiguration
public class Query {
	
	/*
	 * public static void main(String[] args) { ProcessEngine engine =
	 * ProcessEngines.getDefaultProcessEngine(); IdentityService is =
	 * engine.getIdentityService(); for(int i = 0; i < 10; i++) { Group group =
	 * is.newGroup(String.valueOf(i)); group.setName("Group_" + i);
	 * group.setType("TYPE_" + i); is.saveGroup(group); } engine.close();
	 * System.exit(0); }
	 */
	 @Test
	    public void testSend() throws Exception {
		 ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
	        IdentityService is = engine.getIdentityService();
	        for(int i = 0; i < 10; i++) {
	            Group group = is.newGroup(String.valueOf(i));
	            group.setName("Group_" + i);
	            group.setType("TYPE_" + i);
	            is.saveGroup(group);
	        }
	        engine.close();
	        System.exit(0);
	 }
	

}
